<%@page import="java.util.List"%>
<%@page import="java.sql.*"%>
<%@page import="model.Kipmol" %>
<%@page import="database.DBClass"%>
<%
    String kabupaten = request.getParameter("countKec");
    String buffer = "<select name='kecamatan' onchange='showDesa(this.value);'><option value='-1'>Pilih Kecamatan</option>";

    try {
        DBClass dbobject = new DBClass();
        List list = dbobject.getKecamatan(kabupaten);
        request.setAttribute("list", list);
        List list2 = (List) request.getAttribute("list");
        if (list2 != null) {
            for (int i = 0; i < list2.size(); i++) {
                Kipmol ubean = (Kipmol) list2.get(i);
                buffer = buffer + "<option value='" + ubean.getIdTabel() + "'>" + ubean.getNamaTabel() + "</option>";
            }
            buffer = buffer + "</select>";
            response.getWriter().println(buffer);
        }
    } catch (Exception e) {
        System.out.println(e);
    }
%>